<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>">
		<title>设置企业信息</title>
		<%@include file="../collect/meta.jsp"%>
		<link rel="stylesheet" href="css/radius.css" type="text/css"></link>
		<link rel="stylesheet" href="css/Inputstyle.css" type="text/css"></link>
		<script type="text/javascript" src="${ctx}/js/returnTop.js"></script>
		<style>
			td{
				height:60px;
			}
			#but{
				margin-left:80px;
				margin-top:-80px;
			}
		</style>
	</head>
	<body lang="zh-cn">
		<div class="wrapper">
			<c:if test="${qyAuthority == 'yes' }">
			<c:import url="/collect/top.jsp"></c:import>
			</c:if>
			<div class="main-container" id="main-container">
				<div class="main-container-inner">
					<c:if test="${qyAuthority == 'yes' }">
					<c:import url="/collect/left.jsp"></c:import>
					</c:if>
					<div class="main-content">
						<div class="breadcrumbs" id="breadcrumbs">
							<ul class="breadcrumb">
								<li>
									<i class="icon-home home-icon"></i>企业基本信息
								</li>
							</ul>
						</div>
						<div class="page-content">
								<div class="row">
									<div class="col-xs-12">
										<form action="maccount!updateAccountMessage" name="updatewx"method="post">
											<div align="center">
												<table>
													<tr>
														<td>&nbsp;</td>
														<td><div align="right"><label for="accountName">企业名称：&nbsp;</label></div></td>
														<td><input type="text" id="accountName" name="account.name" class="input" value="${account.name}"></td>
														<td><br></td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td><div align="right"><label for="accountEmail">企业邮箱：&nbsp;</label></div></td>
														<td><input type="text" id="accountEmail" name="account.email"class="input" value="${account.email}"></td>
														<td><br></td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td><div align="right"><label for="accountloginName">负责人姓名：&nbsp;</label></div></td>
														<td><input type="text" id="accountloginName" name="account.loginName" class="input" value="${account.loginName}"></td>
														<td><br></td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td><div align="right"><label for="accountMobile">手机号：&nbsp;</label></div></td>
														<td><input type="text" id="accountMobile" name="account.mobile" class="input" value="${account.mobile}"></td>
														<td><br></td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td><div align="right"><label>创建时间：&nbsp;</label></div></td>
														<td><input type="text" name="account.createTime" class="input" value="${fn:substring(account.createTime, 0, fn:indexOf(account.createTime, '.'))}" readonly="readonly"></td>
														<td><br></td>
													</tr>
													<tr>
														<td><input type="hidden" id="actid" name="account.id"value="${account.id}"></td>
													</tr>
												</table>
												<div align="center"><input type="button" class="btn btn-primary radius" id="but" value="提交"></div>
											</div>
										</form>
								</div>
						</div>
					</div>
				</div>
			</div>
			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse" style="position:fixed;bottom:0;">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div>
		<div class="push"></div>
     </div>
     <c:import url="/collect/down.jsp"></c:import>
	 <script type="text/javascript">
		$("#but").click(function() {
			var actName = $("input[id='accountName']").val();
			if (actName.length == 0) {
				alert("企业名称必填");
				return false;
			}
	
			var mobile = $("input[id='accountMobile']").val();
			if (mobile.length == 0) {
				alert("手机号码必填");
				return false;
			}
			var email = $("input[id='accountEmail']").val();
			if (email.length == 0) {
				alert("邮箱必填");
				return false;
			}
			
			$.ajax( {
				async : false,
				url : "maccount!checkAll",
				type : "post",
				data : {
					email : email,
					actName : actName,
					mobile: mobile,
					actid : $("#actid").val()
				},
				datatype : "json",
				success : function(data) {
	
					var d = $.parseJSON(data);
	
					var b = d.check;
					var message = d.message;
					if (b) { // b = true, 验证失败
						alert(message);
					} else {
						updatewx.submit();
					}
				},
				error : function(request) {
					alert("Connection error");
				}
			});
	
		});
		</script>
 	</body>
</html>